package com.itzb.asone.system.repository.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.mybatis.spring.SqlSessionTemplate;

import com.itzb.asone.mybatis.Criteria;
import com.itzb.asone.system.model.SysDict;
import com.itzb.asone.system.repository.ISysDictRepository;

public class SysDictRepositoryImpl implements ISysDictRepository
{
	public List<SysDict> queryPage(Criteria<SysDict> param)
	{
		RowBounds r = null;
		if (param != null) r = new RowBounds(param.getStartIndex(), param.getPageSize());
		return sqlSessionTemplate.selectList(MAPPER_NAMESPACE + ".queryPage", param, new RowBounds(param.getStartIndex(), param.getPageSize()));
	}

	public SysDict queryById(String id)
	{
		return sqlSessionTemplate.selectOne(MAPPER_NAMESPACE + ".queryById", id);
	}

	public int insert(SysDict dict)
	{
		return sqlSessionTemplate.insert(MAPPER_NAMESPACE + ".insert", dict);
	}

	public int updateByCriteria(Criteria<SysDict> param)
	{
		return sqlSessionTemplate.update(MAPPER_NAMESPACE + ".updateByCriteria", param);
	}

	public int deleteById(String id)
	{
		return sqlSessionTemplate.delete(MAPPER_NAMESPACE + ".deleteById", id);
	}

	public int deleteByCriteria(Criteria<SysDict> param)
	{

		return sqlSessionTemplate.insert(MAPPER_NAMESPACE + ".deleteByCriteria", param);

	}

	public int queryPageCount(Criteria<SysDict> param)
	{
		return (Integer) sqlSessionTemplate.selectOne(MAPPER_NAMESPACE + ".queryPageCount", param);
	}
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)
	{
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	private SqlSessionTemplate sqlSessionTemplate;
}
